﻿using System;
using Toast.Core;
using Toast.Core.Interfaces;

namespace Toast.ContentTypes
{
    public static class Content
    {
        public static IContent From(string from)
        {
            return From(from, InjectAt.Default);
        }

        public static IContent From(string from, ICompressionStrategy compressionStrategy)
        {
            return From(from, InjectAt.Default, compressionStrategy);
        }

        public static IContent From(string from, InjectAt injectAt)
        {
            return ContentTypeResolver.Discover(from, injectAt);
        }

        public static IContent From(string from, Func<bool> injectIf)
        {
            var ss = From(from, InjectAt.Default);
            ss.InjectIf = injectIf;
            return ss;
        }

        public static IContent From(string from, InjectAt injectAt, ICompressionStrategy compressionStrategy)
        {
            var result = From(from);
            result.Compression = compressionStrategy;
            return result;
        }
    }
}